module.exports = {
    asData(use) {
        return use ? {
            role: use.role && use.role.summary || false,
            card: use.card && use.card.data || false,
            targets: use.targets || false,
            result: this.asResultData(use.result),
        } : false;
    },
    asResultData(result) {
        return result && {
            pile: result.pile === false ? false : true,
            cards: result.cards && result.cards.map(card => card.data) || false,
        } || false;
    },
    asUse(card, targets, role, result) {
        return {
            card, targets, 
            role: role || false, 
            result: result || false,
        }
    },
    asRoleResult({ card, targets }, result) {
        return {
            card, targets,
            result: result || false,
        }
    },
    asResult({ card, targets, role }, result) {
        return {
            card, targets, role,
            result: result || false,
        }
    }
}